package com.github.tangmonkmeat;

import java.util.Scanner;

/**
 * Description:
 *
 * @author zwl
 * @version 1.0
 * @date 2021/8/17 下午3:21
 */
public class 版本升级 {

    public static void main(String[] args){
        try(Scanner sc = new Scanner(System.in)){
            int m = sc.nextInt();
            boolean[] flag = new boolean[m];
            for(int i = 0;i < m;i++){
                String a = sc.next();
                String b = sc.next();
                flag[i] = enableFlag(a.toCharArray(),b.toCharArray());
            }

            for (boolean b : flag) {
                System.out.println(b);
            }
        }
    }

    public static boolean enableFlag(char[] as,char[] bs){
        int len = Math.min(as.length,bs.length);
        int ws = bs.length  - as.length;
        int i = 0;
        int ai = 0, bi = 0;
        for(;i < len;i+=2){
            ai = ai * 10 + as[i] - '0';
            bi = bi * 10 + bs[i] - '0';
        }
        if (ai > bi){
            return false;
        }
        if(ws > 0){
            for(;i < bs.length;i+=2){
                if(bs[i] != '.' && bs[i] != '0'){
                    return true;
                }
            }
        }
        return ws == 0;
    }
}
